package j06date;

import java.text.SimpleDateFormat;
import java.util.Date;

public class J1 {
    public static void main(String[] args) {
        Date now = new Date();
        //2022-4-22 11:11:11
        //2022-04-22 11:01:11
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd$$$HH:mm:ss");
        String s1 = sdf.format(now);
        System.out.println("s1 = " + s1);

        String dateStr = "2022=12=22 12:44:05";
        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy=MM=dd HH:mm:ss");
        try {
            Date date2 = sdf2.parse(dateStr);
            System.out.println("date2 = " + date2);
        }catch (Exception e){
            e.printStackTrace();
        }


    }
}
